import 'package:flutter/material.dart';

enum AppThemeMode {
  light(name: "浅色模式", value: 0),  //浅色
  dark(name: "深色模式", value: 1),   //深色
  // system, //跟随系统
  ;

  final String name;
  final int value;
  const AppThemeMode({required this.name, required this.value});

  //themeMode
  ThemeMode get themeMode {
    switch (this) {
      case AppThemeMode.light:
        return ThemeMode.light;
      case AppThemeMode.dark:
        return ThemeMode.dark;
    // case AppThemeMode.system:
    //   return ThemeMode.system;
    }
  }

  //通过值生成枚举
  static AppThemeMode of(int? value) {
    switch (value) {
      case 0:
        return AppThemeMode.light;
      default:
        return AppThemeMode.dark;
    // default:
    //   return AppThemeMode.system;
    }
  }
}